<?php
namespace app\usermodule\controllers;

use app\models\UpModel;
use yii\web\UploadedFile;

class UploadController extends BaseController{

    public function actionUp(){
        if(\Yii::$app->request->isPost){
            $model = new UpModel();
            $model->up_image = UploadedFile::getInstance($model,'up_image');
            $result = $model->up();
            return json_encode($result,JSON_NUMERIC_CHECK);
        }else{
            $result = ['result'=>0,'data'=>'请从微信小程序上传图片'];
            return json_encode($result);
        }
    }

}
